<?php
/**************************************************
HTML below. No form tag 
(though if you'd like to include another form, 
just close one, and open the new one right after,
like so: </form><form method="post" action="">)
***************************************************/

//Must be included at the top of all mod files.
if(!defined('DREAMSCAPE')){
die('Sorry, but this file cannot be directly viewed.');
}
 ?>
<?php
//If you're adding content, use this block
if(ADDING):								
?>
<label for="online"><?php echo L_ONLINE; ?></label><input name="online" class="cBox" type="checkbox" id="online" value="1" checked="checked" /><br />
<label for="title"><?php echo L_TITLE; ?></label><input name="title" type="text" class="formfields" id="title" size="30" /><input type="hidden" name="aid" value="<?php echo $_SESSION['id']; ?>" /><input type="hidden" name="pid" value="<?php echo $catid; ?>" /><input type="hidden" name="MAX_FILE_SIZE" value="300000000000000" /><br />
<label for="image"><?php echo L_IMAGE; ?></label><input type="file" id="image" name="image" size="30" class="formfields" /><br />
<label for="url"><?php echo L_URL; ?></label><input name="url" type="text" class="formfields" id="url" size="30" /><br />

<label for="descr"><?php echo L_BODY; ?></label><textarea name="descr" cols="30" rows="5" id="descr" class="formfields"></textarea><br />

<label for="smilies"><?php echo L_USE_SMILIES; ?></label><input name="smilies" class="cBox" type="checkbox" id="smilies" value="1" checked="checked" />
<br />
<label for="comments"><?php echo L_ALLOW_COMMENTS; ?></label><input name="comments" class="cBox" type="checkbox" id="comments" value="1" checked="checked" />
<br />
<?php $the_module->custom_fields(); ?>
<div class="stretchContainer">
<?php 
$the_module->more_options(
	array(
	L_CATEGORY_OPTIONS => 'doCategories'
	)
);
$the_module->more_options(L_POST_TIME_ADD, 'doDateTimeForms', 'editDateTimeContainer');
?>
</div>
<label for="add"></label><input name="submit" type="submit" class="buttons" id="submit" value="<?php echo L_BUTTON_ADD ?>" />
<?php endif; ?>
<?php 
#If you're editing content, use this block
if(EDITING): ?>

		<?php if(EDIT_SINGLE): ?>
		<label for="online"><?php echo L_ONLINE; ?></label>
		<input type="hidden" name="online" value="0" id="" /><input class="cBox" type="checkbox" name="online" value="1" id="online"  <?php echo ($items->online == 1) ? 'checked="checked"' : '';?> /><br />
		<?php echo preview_link(); ?>
<label for="title"><?php echo L_TITLE; ?></label>
<input name="title" type="text" class="formfields" id="title" value="<?php echo view($items->title);?>" size="30" /><input type="hidden" name="MAX_FILE_SIZE" value="3000000000" /><br />
<p id="thumbNails"><img src="funcs/tn.lib.php?dim=200&amp;id=<?php echo $items->id ?>&amp;<?php echo time(); ?>" alt="<?php echo $items->image ?>" id="thumbNailMain" class="thumbnails" /></p><br />
<label for="image"><?php echo L_IMAGE; ?></label> 
<input type="file" id="image" name="image" size="30" class="formfields" /><br />
<label for="url"><?php echo L_URL; ?></label><input name="url" type="text" class="formfields" id="url" value="<?php echo $items->url; ?>" size="30" /><br />
<label for="descr"><?php echo L_BODY; ?></label><textarea name="descr" cols="30" rows="5" id="descr" class="formfields"><?php echo view($items->descr); ?></textarea><br />

<label for="smilies"><?php echo L_USE_SMILIES; ?></label><input type="hidden" name="smilies" value="0" /><input class="cBox" type="checkbox" name="smilies" value="1" id="smilies"  <?php echo ($items->smilies == 1) ? 'checked="checked"' : '';?><?php echo $items->smilies;?> /><br />
<label for="comments"><?php echo L_ALLOW_COMMENTS; ?></label><input type="hidden" name="comments" value="0" id="" /><input class="cBox" type="checkbox" name="comments" value="1" id="comments"  <?php echo ($items->comments == 1) ? 'checked="checked"' : '';?>  /><br />
<?php $the_module->custom_fields(); ?>
<div class="stretchContainer">
<?php 
$the_module->more_options(
	array(
	L_CATEGORY_OPTIONS => 'doCategories',
	L_CLEAN_URL_TITLES => 'doCleanURLTitles'
	)
);
$the_module->more_options(L_SHARE_ITEM, 'doSharing', 'sharing');
$the_module->more_options(L_POST_TIME_EDIT, 'doDateTimeForms', 'editDateTimeContainer');
?>
</div>
<br />
		<label for="edit"></label><input name="submit" type="submit" class="buttons" id="submit" value="edit" />
		<?php elseif(EDIT_LIST): ?>
		<?php $the_module->doSort(); ?>
			<?php
			$itemsList = paginate($itemsList, '', EDIT_LIMIT);
			$numitems = count($itemsList);
			$hasitems = $numitems ? true : false;
			?>
			<div id="itemList">
			<?php 
			foreach($itemsList as $ind => $item):
			$item->title = trim_title($item->title);
			$item->descr = trim_excerpt($item->descr);
			$users->Get($item->aid);
			$the_displayname = $users->displayname;
			$the_username = $users->username;
			$has_subcat = ($item->cid != $item->pid && $item->cid != 0) ? true : false;
			if($has_subcat){
				$sections->Get($item->cid);
				$category = $sections->sectionname;
			}
			?>
			<div id="item_<?php echo $item->id ?>">
	  <img class="thumbnails" src="funcs/tn.lib.php?dim=70&thumb=1&id=<?php echo $item->id ?>" alt="<?php echo $item->thumbnail ?>" /><h1><?php echo $item->title ?></h1>
      <h2 class="<?php echo ($item->online == 0) ? 'offline' : 'online'; ?>"><?php echo ($item->online == 0) ? L_ITEM_OFFLINE : L_ITEM_ONLINE; ?></h2>
      <h3><?php printf(L_POSTED_BY, $the_displayname, $the_username);?></h3>
     <?php if($has_subcat){
	 ?> <h3><?php echo L_SUB_CATEGORY ?>: <?php echo $category; ?></h3><?php 
	 }
	 ?>
      <a href="<?php echo edit_link($item->id); ?>" title="<?php echo L_EDIT_ITEM ?>"><?php echo L_EDIT_ITEM; ?></a> <br />
<a href="<?php echo edit_link($item->id); ?>#sharing" title="<?php echo L_SHARE_ITEM; ?>" class="shareLink"><?php echo L_SHARE_ITEM; ?></a> 
	  <fieldset>
 <label for="item_delete_<?php echo $item->id; ?>"><?php echo L_DELETE_ITEM ?></label><input type="checkbox" name="del[]" value="<?php echo $item->id; ?>" id="item_delete_<?php echo $item->id; ?>" /><br />

</fieldset>
	  </div>
			<?php 
			endforeach;
			?>
			<input type="hidden" value="<?php echo getOption('sortcats'); ?>" id="order_by" />
			</div>

<?php if($hasitems): ?><label for="delete"></label><input name="submit" type="submit" class="buttons" id="submit" value="<?php echo L_BUTTON_DELETE ?>" />
<?php endif; ?>
		<?php endif; ?>
		
<?php endif; ?>
